'use strict'
const path = require('path')
const defaultSettings = require('./src/settings.js')

function resolve(dir) {
  return path.join(__dirname, dir)
}

const name = defaultSettings.title || 'vue Element Admin' // page title

const webpack = require('webpack')
// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {
  /**
   * You will need to set publicPath if you plan to deploy your site under a sub path,
   * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
   * then publicPath should be set to "/bar/".
   * In most cases please use '/' !!!
   * Detail: https://cli.vuejs.org/config/#publicpath
   */
  publicPath: './',
  outputDir: 'insight',
  assetsDir: 'static',
  lintOnSave: false,
  productionSourceMap: false,
  chainWebpack(config) {
    config.plugin('provide').use(webpack.ProvidePlugin, [{
      'window.Quill': 'quill/dist/quill.js',
      'Quill': 'quill/dist/quill.js'
    }])
    config.optimization.minimizer('terser').tap((args) => {
      args[0].terserOptions.compress.drop_console = process.env.NODE_ENV === 'production';
      args[0].terserOptions.compress.drop_debugger = process.env.NODE_ENV === 'production';
      return args;
    })
  },
}
